import Vue from 'vue'
import Vuex from 'vuex'

// 引入axios
// import axios from 'axios'

Vue.use(Vuex)

export default new Vuex.Store({
  state: {
    // 银行卡数据
    listCards: [
      { cardNum: '10638736377834', momey: '200' },
      { cardNum: '10638736377835', momey: '100' }
    ],
    // 服务数据
    listServce: [
      { service1: 'loans1', service2: 'loans2' },
      { service1: 'loans1', service2: 'loans2' },
      { service1: 'loans1', service2: 'loans2' }
    ]
  },
  mutations: {
    // 设置数据
    // setData (state, data) {
    //   state.listCards = data
    //   console.log(state.listCards)
    // },
    // 数据加密处理
    change (state) {
      for (var i = 0; i < state.listCards.length; i++) {
        state.listCards[i].cardNum = state.listCards[i].cardNum.substring(11)
      }
    }
  },
  actions: {
    // 获取数据库数据
    // getList (context) {
    //   axios.get(url)
    //     .then(res => { context.commit('setData', res.data) })
    //     .catch(err => { console.log(err) })
    // }
  },
  getters: {
  },
  modules: {
  }
})
